{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "gpuType": "A100",
      "machine_shape": "hm"
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "accelerator": "GPU",
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "d8cec6c8ec13448a82ef00b30f0c4d28": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_3cb8d59805fa4efdadfef602be77e0f9",
              "IPY_MODEL_276d0ab112da44deafaccab80920dd6b",
              "IPY_MODEL_47ff87ea856241fbb83ddbb0e740ade4"
            ],
            "layout": "IPY_MODEL_68699308e68f451dbeaa95b6d4d65f8c"
          }
        },
        "3cb8d59805fa4efdadfef602be77e0f9": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_3373b9d79a6b497fbf21e7842f4e28ea",
            "placeholder": "​",
            "style": "IPY_MODEL_5f535cf890d94da8baefcd8272c8e49f",
            "value": "tokenizer_config.json: 100%"
          }
        },
        "276d0ab112da44deafaccab80920dd6b": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_cfa2e83effcf4d6eaab3142e061e80d4",
            "max": 26,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_9b4610f67bb94e11ac8a155ac2835663",
            "value": 26
          }
        },
        "47ff87ea856241fbb83ddbb0e740ade4": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_a66cd7d064874120b6d61111203d51eb",
            "placeholder": "​",
            "style": "IPY_MODEL_f5b24478e3684803a877fe99ff7ba390",
            "value": " 26.0/26.0 [00:00&lt;00:00, 2.26kB/s]"
          }
        },
        "68699308e68f451dbeaa95b6d4d65f8c": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "3373b9d79a6b497fbf21e7842f4e28ea": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "5f535cf890d94da8baefcd8272c8e49f": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "cfa2e83effcf4d6eaab3142e061e80d4": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "9b4610f67bb94e11ac8a155ac2835663": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "a66cd7d064874120b6d61111203d51eb": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "f5b24478e3684803a877fe99ff7ba390": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "d083823f11a643d0b7dc8f35b019c1dd": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_3615cf90807b40a398e4f2a8bd272ea7",
              "IPY_MODEL_25b1e77e204549c0a55aab7510f92505",
              "IPY_MODEL_db00a02499654f51b39f935aefd7a861"
            ],
            "layout": "IPY_MODEL_209674da51ca40018f1ffd74cf4b987e"
          }
        },
        "3615cf90807b40a398e4f2a8bd272ea7": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_a6ecc913f8b64b9b9a1cd7c24863dc35",
            "placeholder": "​",
            "style": "IPY_MODEL_186cf3c740f444889b64d2c6e0185f46",
            "value": "vocab.json: 100%"
          }
        },
        "25b1e77e204549c0a55aab7510f92505": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_180bd8b5a9c849148b615f087913e916",
            "max": 1042301,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_633b094d6e034782ab5d7a33b9a07af0",
            "value": 1042301
          }
        },
        "db00a02499654f51b39f935aefd7a861": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_5cc640ad49f246b69043b5ad689286c9",
            "placeholder": "​",
            "style": "IPY_MODEL_649c6807b22e4029b95faea92fbb1cb3",
            "value": " 1.04M/1.04M [00:00&lt;00:00, 1.24MB/s]"
          }
        },
        "209674da51ca40018f1ffd74cf4b987e": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "a6ecc913f8b64b9b9a1cd7c24863dc35": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "186cf3c740f444889b64d2c6e0185f46": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "180bd8b5a9c849148b615f087913e916": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "633b094d6e034782ab5d7a33b9a07af0": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "5cc640ad49f246b69043b5ad689286c9": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "649c6807b22e4029b95faea92fbb1cb3": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "740e94769ff249558b57ef19282c1b11": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_378656b9c4634b4faaa19cf6c6f18499",
              "IPY_MODEL_03a08b534bae49d9ad0b30c2e36c5831",
              "IPY_MODEL_1f2560b72d7344ce91453a13e424ed44"
            ],
            "layout": "IPY_MODEL_0ccdfabf7b0444bc9c716442aafa8506"
          }
        },
        "378656b9c4634b4faaa19cf6c6f18499": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_d4df275a8f8e4deb8cbb0c87237552c7",
            "placeholder": "​",
            "style": "IPY_MODEL_76ab6d53c09f4c5dbe9d310a23438ee6",
            "value": "merges.txt: 100%"
          }
        },
        "03a08b534bae49d9ad0b30c2e36c5831": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_51c2ec9200674aa3a7b40a75fc9e22fc",
            "max": 456318,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_7683ef3edbd2433382c1c86bfcbd2e36",
            "value": 456318
          }
        },
        "1f2560b72d7344ce91453a13e424ed44": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_f5ba48be22084276a19cabac650b7a50",
            "placeholder": "​",
            "style": "IPY_MODEL_815811c186a340eda936f630b4373515",
            "value": " 456k/456k [00:00&lt;00:00, 1.08MB/s]"
          }
        },
        "0ccdfabf7b0444bc9c716442aafa8506": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "d4df275a8f8e4deb8cbb0c87237552c7": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "76ab6d53c09f4c5dbe9d310a23438ee6": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "51c2ec9200674aa3a7b40a75fc9e22fc": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "7683ef3edbd2433382c1c86bfcbd2e36": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "f5ba48be22084276a19cabac650b7a50": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "815811c186a340eda936f630b4373515": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "b4e05fe518974f6cabc7219e88f9eb93": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_be35afa8d6b84b6fb2035a1fa8dd803b",
              "IPY_MODEL_04980866b0e548838bff15d22cd2ee51",
              "IPY_MODEL_a8cbcef5eaed4d3eb4bebdc366445ba0"
            ],
            "layout": "IPY_MODEL_c4f3efbdd25e4771bcfeb941060f9cc3"
          }
        },
        "be35afa8d6b84b6fb2035a1fa8dd803b": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_554acf4270bf40579fe3362b2feed22d",
            "placeholder": "​",
            "style": "IPY_MODEL_abbc55ae4aec4d679d2588b474d1830e",
            "value": "tokenizer.json: 100%"
          }
        },
        "04980866b0e548838bff15d22cd2ee51": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_e01cd3d9bbe14234ba67d921af2c0352",
            "max": 1355256,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_0c0736b49cfa4604ba8e1accbd6ddbe1",
            "value": 1355256
          }
        },
        "a8cbcef5eaed4d3eb4bebdc366445ba0": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_7b0f976d73f44eed8507c13fbc0fff27",
            "placeholder": "​",
            "style": "IPY_MODEL_d6af0bde62c24c948e37494a05744793",
            "value": " 1.36M/1.36M [00:00&lt;00:00, 1.61MB/s]"
          }
        },
        "c4f3efbdd25e4771bcfeb941060f9cc3": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "554acf4270bf40579fe3362b2feed22d": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "abbc55ae4aec4d679d2588b474d1830e": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "e01cd3d9bbe14234ba67d921af2c0352": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "0c0736b49cfa4604ba8e1accbd6ddbe1": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "7b0f976d73f44eed8507c13fbc0fff27": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "d6af0bde62c24c948e37494a05744793": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "8f4808b72f0e432f8801f853eb8b5c26": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_424a3c01e1dd40a3850dc540b0af1877",
              "IPY_MODEL_5857760b8e96484683ce28d2740ab534",
              "IPY_MODEL_d7694235c67b455cb4b62e853b1349a4"
            ],
            "layout": "IPY_MODEL_91deb9f34cc24f0faab713587fbf465b"
          }
        },
        "424a3c01e1dd40a3850dc540b0af1877": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_78232a0e7dee40639088fb7d6a9fc193",
            "placeholder": "​",
            "style": "IPY_MODEL_d95f39edede5450a9790f55fec99530a",
            "value": "config.json: 100%"
          }
        },
        "5857760b8e96484683ce28d2740ab534": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_ca78cb2a33234f589b973dd6a8c4a894",
            "max": 666,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_387366879eeb42edbffabde822cb179c",
            "value": 666
          }
        },
        "d7694235c67b455cb4b62e853b1349a4": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_4ba767487b074fc4ac07d5325f3ad79c",
            "placeholder": "​",
            "style": "IPY_MODEL_a277967547994ad9be23ce151c9037d7",
            "value": " 666/666 [00:00&lt;00:00, 59.7kB/s]"
          }
        },
        "91deb9f34cc24f0faab713587fbf465b": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "78232a0e7dee40639088fb7d6a9fc193": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "d95f39edede5450a9790f55fec99530a": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "ca78cb2a33234f589b973dd6a8c4a894": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "387366879eeb42edbffabde822cb179c": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "4ba767487b074fc4ac07d5325f3ad79c": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "a277967547994ad9be23ce151c9037d7": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "bd4f3690ffa242e2b9e4de71a78dddc3": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_99b375f783244c3eb36d50fc0652f641",
              "IPY_MODEL_b027db693734481797d13bcf4602f7d0",
              "IPY_MODEL_0acc65bed8a140c18252411231b24961"
            ],
            "layout": "IPY_MODEL_1e1421e1d76243a788a36b277e0167b1"
          }
        },
        "99b375f783244c3eb36d50fc0652f641": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_a27ead8dd9534bbfbc8a030771e7d88d",
            "placeholder": "​",
            "style": "IPY_MODEL_0e4033d04c2d4bffad6a15b23eb35fbe",
            "value": "model.safetensors: 100%"
          }
        },
        "b027db693734481797d13bcf4602f7d0": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_e745bf9f5fc342a197ed9de56f867f6e",
            "max": 3247159078,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_14faaca509e045ce9c0352378ffca23c",
            "value": 3247159078
          }
        },
        "0acc65bed8a140c18252411231b24961": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_a19ab54b54f94d65bc7d061d3ccaaee4",
            "placeholder": "​",
            "style": "IPY_MODEL_394fd351a62244418a1ab7cc4c71a45d",
            "value": " 3.25G/3.25G [04:08&lt;00:00, 7.34MB/s]"
          }
        },
        "1e1421e1d76243a788a36b277e0167b1": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "a27ead8dd9534bbfbc8a030771e7d88d": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "0e4033d04c2d4bffad6a15b23eb35fbe": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "e745bf9f5fc342a197ed9de56f867f6e": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "14faaca509e045ce9c0352378ffca23c": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "a19ab54b54f94d65bc7d061d3ccaaee4": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "394fd351a62244418a1ab7cc4c71a45d": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "4dabc1245b5346fdaaaaa2d447554860": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_f3a91a3408cc4eff821735678ede1cea",
              "IPY_MODEL_72912dec44ae45fd9d31e2b01808c6a0",
              "IPY_MODEL_36f11973d67b41cc9c06f50c420eba9c"
            ],
            "layout": "IPY_MODEL_b8331b28d51b4db0b8090605784745bf"
          }
        },
        "f3a91a3408cc4eff821735678ede1cea": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_d35e8f82c60347c6933e5c55cfaabb01",
            "placeholder": "​",
            "style": "IPY_MODEL_05c7cca7465648e3b83b546b96662a84",
            "value": "generation_config.json: 100%"
          }
        },
        "72912dec44ae45fd9d31e2b01808c6a0": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_01c6f0fdf17743b0b79a980883e0a468",
            "max": 124,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_7aa716615c834297823bfc15b8b5b12b",
            "value": 124
          }
        },
        "36f11973d67b41cc9c06f50c420eba9c": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_1b3db6d5760d4198a686d03149fa8a2c",
            "placeholder": "​",
            "style": "IPY_MODEL_60520bd499404ad4a36d8bea6d65cacc",
            "value": " 124/124 [00:00&lt;00:00, 11.3kB/s]"
          }
        },
        "b8331b28d51b4db0b8090605784745bf": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "d35e8f82c60347c6933e5c55cfaabb01": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "05c7cca7465648e3b83b546b96662a84": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "01c6f0fdf17743b0b79a980883e0a468": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "7aa716615c834297823bfc15b8b5b12b": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "1b3db6d5760d4198a686d03149fa8a2c": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "60520bd499404ad4a36d8bea6d65cacc": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        }
      }
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "uVehGld9c3mq",
        "outputId": "6c27c3f5-a436-42b3-af7e-c81cfc93b0e9"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m50.4/50.4 kB\u001b[0m \u001b[31m1.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m52.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.6/49.6 kB\u001b[0m \u001b[31m4.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.4/2.4 MB\u001b[0m \u001b[31m84.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m471.6/471.6 kB\u001b[0m \u001b[31m36.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m62.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m383.5/383.5 kB\u001b[0m \u001b[31m31.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m245.3/245.3 kB\u001b[0m \u001b[31m22.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m116.3/116.3 kB\u001b[0m \u001b[31m11.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m76.4/76.4 kB\u001b[0m \u001b[31m7.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m78.0/78.0 kB\u001b[0m \u001b[31m7.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m318.9/318.9 kB\u001b[0m \u001b[31m28.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m400.9/400.9 kB\u001b[0m \u001b[31m35.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m292.2/292.2 kB\u001b[0m \u001b[31m25.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m134.8/134.8 kB\u001b[0m \u001b[31m12.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m194.1/194.1 kB\u001b[0m \u001b[31m18.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.3/49.3 kB\u001b[0m \u001b[31m4.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m141.9/141.9 kB\u001b[0m \u001b[31m14.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m5.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25h"
          ]
        }
      ],
      "source": [
        "!pip install langchain langchain-openai langchain-community datasets tiktoken openai sentence-transformers --quiet\n"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "!pip install --upgrade pyarrow --quiet # Reinstall to update pyarrow\n",
        "!pip install datasets --upgrade --quiet # Reinstall to update datasets"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "8o3unXzymMu7",
        "outputId": "3eab10ef-1360-4463-dcff-7b655b4cd0cb"
      },
      "execution_count": 2,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m39.9/39.9 MB\u001b[0m \u001b[31m55.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25h\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
            "cudf-cu12 24.6.1 requires pyarrow<16.2.0a0,>=16.1.0, but you have pyarrow 17.0.0 which is incompatible.\u001b[0m\u001b[31m\n",
            "\u001b[0m"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import sqlite3\n",
        "from typing import List, Tuple\n",
        "from langchain_openai import ChatOpenAI\n",
        "from langchain.prompts import ChatPromptTemplate\n",
        "from langchain.schema import StrOutputParser\n",
        "from langchain_core.runnables import RunnablePassthrough\n",
        "import os\n",
        "\n",
        "# Set your OpenAI API key\n",
        "os.environ[\"OPENAI_API_KEY\"] = '<PUT YOUR API KEY HERE>'\n",
        "\n",
        "# 1.1. Fundamentals of Natural Language Interfaces for Databases\n",
        "class DatabaseInterface:\n",
        "    def __init__(self):\n",
        "        self.conn = sqlite3.connect(':memory:')\n",
        "        self.cursor = self.conn.cursor()\n",
        "        self.create_sample_data()\n",
        "\n",
        "    def create_sample_data(self):\n",
        "        self.cursor.execute('''\n",
        "            CREATE TABLE employees (\n",
        "                id INTEGER PRIMARY KEY,\n",
        "                name TEXT,\n",
        "                department TEXT,\n",
        "                salary INTEGER\n",
        "            )\n",
        "        ''')\n",
        "        self.cursor.executemany('''\n",
        "            INSERT INTO employees (name, department, salary) VALUES (?, ?, ?)\n",
        "        ''', [\n",
        "            ('John Doe', 'IT', 75000),\n",
        "            ('Jane Smith', 'HR', 65000),\n",
        "            ('Bob Johnson', 'Sales', 80000),\n",
        "            ('Alice Brown', 'IT', 72000)\n",
        "        ])\n",
        "        self.conn.commit()\n",
        "\n",
        "    def execute_query(self, query: str) -> List[Tuple]:\n",
        "        self.cursor.execute(query)\n",
        "        return self.cursor.fetchall()\n",
        "\n",
        "    def get_schema(self) -> str:\n",
        "        return \"Table: employees (id: INTEGER, name: TEXT, department: TEXT, salary: INTEGER)\"\n",
        "\n",
        "# 1.2. Tailoring LLMs for Data Query Interpretation\n",
        "class QueryInterpreter:\n",
        "    def __init__(self):\n",
        "        self.llm = ChatOpenAI(temperature=0)\n",
        "        self.prompt = ChatPromptTemplate.from_template(\n",
        "            \"Given the following SQL schema:\\n{schema}\\n\\nGenerate a SQL query to answer the following question:\\n{query}\\n\\nSQL Query:\"\n",
        "        )\n",
        "        self.chain = self.prompt | self.llm | StrOutputParser()\n",
        "\n",
        "    def generate_sql(self, schema: str, query: str) -> str:\n",
        "        return self.chain.invoke({\"schema\": schema, \"query\": query}).strip()\n",
        "\n",
        "# 1.3. Testing and Optimization of Conversational Systems\n",
        "def test_conversational_system(db: DatabaseInterface, interpreter: QueryInterpreter, test_queries: List[str]):\n",
        "    schema = db.get_schema()\n",
        "    for query in test_queries:\n",
        "        print(f\"User Input: {query}\")\n",
        "        sql_query = interpreter.generate_sql(schema, query)\n",
        "        print(f\"Generated SQL: {sql_query}\")\n",
        "        result = db.execute_query(sql_query)\n",
        "        print(f\"Result: {result}\\n\")\n",
        "\n",
        "# 1.4. LLM Operations for Conversational Interfaces\n",
        "class ConversationalInterface:\n",
        "    def __init__(self, db: DatabaseInterface, interpreter: QueryInterpreter):\n",
        "        self.db = db\n",
        "        self.interpreter = interpreter\n",
        "        self.schema = db.get_schema()\n",
        "        self.llm = ChatOpenAI(temperature=0)\n",
        "\n",
        "        self.response_prompt = ChatPromptTemplate.from_template(\n",
        "            \"Given the user question: '{user_input}'\\nAnd the SQL query: '{sql_query}'\\nFormat this result in a natural language response: {result}\"\n",
        "        )\n",
        "        self.response_chain = self.response_prompt | self.llm | StrOutputParser()\n",
        "\n",
        "    def process_user_input(self, user_input: str):\n",
        "        sql_query = self.interpreter.generate_sql(self.schema, user_input)\n",
        "        result = self.db.execute_query(sql_query)\n",
        "        return self.format_response(user_input, result, sql_query)\n",
        "\n",
        "    def format_response(self, user_input: str, result: List[Tuple], sql_query: str) -> str:\n",
        "        return self.response_chain.invoke({\n",
        "            \"user_input\": user_input,\n",
        "            \"sql_query\": sql_query,\n",
        "            \"result\": str(result)\n",
        "        }).strip()\n",
        "\n",
        "# Main execution\n",
        "if __name__ == \"__main__\":\n",
        "    db = DatabaseInterface()\n",
        "    interpreter = QueryInterpreter()\n",
        "    interface = ConversationalInterface(db, interpreter)\n",
        "\n",
        "    # Test the system\n",
        "    test_queries = [\n",
        "        \"What is the average salary?\",\n",
        "        \"Who are the employees in IT?\",\n",
        "        \"Who is the highest paid employee?\",\n",
        "        \"Show me all employees\"\n",
        "    ]\n",
        "\n",
        "    print(\"Testing the conversational system:\")\n",
        "    test_conversational_system(db, interpreter, test_queries)\n",
        "\n",
        "    print(\"\\nInteracting with the conversational interface:\")\n",
        "    while True:\n",
        "        user_input = input(\"Ask a question (or type 'exit' to quit): \")\n",
        "        if user_input.lower() == 'exit':\n",
        "            break\n",
        "        response = interface.process_user_input(user_input)\n",
        "        print(response)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "DEbcmPJ3lUub",
        "outputId": "4932983e-b3b2-4b47-d42c-32eaaa30a62b"
      },
      "execution_count": 3,
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Testing the conversational system:\n",
            "User Input: What is the average salary?\n",
            "Generated SQL: SELECT AVG(salary) AS average_salary\n",
            "FROM employees;\n",
            "Result: [(73000.0,)]\n",
            "\n",
            "User Input: Who are the employees in IT?\n",
            "Generated SQL: SELECT name\n",
            "FROM employees\n",
            "WHERE department = 'IT';\n",
            "Result: [('John Doe',), ('Alice Brown',)]\n",
            "\n",
            "User Input: Who is the highest paid employee?\n",
            "Generated SQL: SELECT name\n",
            "FROM employees\n",
            "ORDER BY salary DESC\n",
            "LIMIT 1;\n",
            "Result: [('Bob Johnson',)]\n",
            "\n",
            "User Input: Show me all employees\n",
            "Generated SQL: SELECT * FROM employees;\n",
            "Result: [(1, 'John Doe', 'IT', 75000), (2, 'Jane Smith', 'HR', 65000), (3, 'Bob Johnson', 'Sales', 80000), (4, 'Alice Brown', 'IT', 72000)]\n",
            "\n",
            "\n",
            "Interacting with the conversational interface:\n",
            "Ask a question (or type 'exit' to quit): exit\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import torch\n",
        "from transformers import GPT2LMHeadModel, GPT2Tokenizer, TextDataset, DataCollatorForLanguageModeling\n",
        "from transformers import Trainer, TrainingArguments\n",
        "import pandas as pd\n",
        "import random\n",
        "import re\n",
        "\n",
        "# Set up device\n",
        "device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
        "\n",
        "# Load pre-trained model and tokenizer\n",
        "model_name = \"gpt2-large\"\n",
        "tokenizer = GPT2Tokenizer.from_pretrained(model_name)\n",
        "model = GPT2LMHeadModel.from_pretrained(model_name).to(device)\n",
        "\n",
        "# Add special tokens\n",
        "special_tokens = {\"pad_token\": \"<PAD>\", \"sep_token\": \"<SEP>\", \"cls_token\": \"<CLS>\"}\n",
        "tokenizer.add_special_tokens(special_tokens)\n",
        "model.resize_token_embeddings(len(tokenizer))\n",
        "\n",
        "# Create a more diverse and complex synthetic dataset\n",
        "def create_dataset():\n",
        "    data = []\n",
        "    tables = ['products', 'orders', 'customers', 'employees', 'sales']\n",
        "    columns = {\n",
        "        'products': ['id', 'name', 'category', 'price'],\n",
        "        'orders': ['id', 'customer_id', 'order_date', 'total_amount'],\n",
        "        'customers': ['id', 'name', 'region', 'total_purchases'],\n",
        "        'employees': ['id', 'name', 'department', 'hire_date'],\n",
        "        'sales': ['id', 'product_id', 'employee_id', 'quantity', 'sale_date', 'sales_amount']\n",
        "    }\n",
        "\n",
        "    query_templates = [\n",
        "        (\"Show total sales for each {table} {column}\",\n",
        "         \"SELECT {table}.{column}, SUM(sales.sales_amount) AS total_sales FROM {table} JOIN sales ON {table}.id = sales.{table}_id GROUP BY {table}.{column} ORDER BY total_sales DESC LIMIT 10;\"),\n",
        "        (\"Average {column} in {table} for the last quarter\",\n",
        "         \"SELECT AVG({column}) AS avg_{column} FROM {table} WHERE {date_column} >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH);\"),\n",
        "        (\"List {table} where {column} {operator} {value}\",\n",
        "         \"SELECT * FROM {table} WHERE {column} {operator} '{value}';\"),\n",
        "        (\"Count of {table} grouped by {column}\",\n",
        "         \"SELECT {column}, COUNT(*) AS count FROM {table} GROUP BY {column} HAVING COUNT(*) > 5;\"),\n",
        "        (\"Find {table1} not in {table2} this year\",\n",
        "         \"SELECT {table1}.* FROM {table1} LEFT JOIN {table2} ON {table1}.id = {table2}.{table1}_id WHERE {table2}.id IS NULL AND YEAR({table1}.{date_column}) = YEAR(CURDATE());\"),\n",
        "        (\"Top selling products in each {column}\",\n",
        "         \"SELECT {table}.{column}, products.name, SUM(sales.quantity) as total_sold FROM {table} JOIN products ON {table}.id = products.{table}_id JOIN sales ON products.id = sales.product_id GROUP BY {table}.{column}, products.name ORDER BY total_sold DESC LIMIT 5;\"),\n",
        "        (\"Most popular products in each region\",\n",
        "         \"SELECT c.region, p.name, SUM(s.quantity) as total_sold FROM customers c JOIN orders o ON c.id = o.customer_id JOIN sales s ON o.id = s.order_id JOIN products p ON s.product_id = p.id GROUP BY c.region, p.id HAVING total_sold = (SELECT SUM(s2.quantity) FROM sales s2 JOIN orders o2 ON s2.order_id = o2.id JOIN customers c2 ON o2.customer_id = c2.id WHERE c2.region = c.region GROUP BY s2.product_id ORDER BY SUM(s2.quantity) DESC LIMIT 1);\")\n",
        "    ]\n",
        "\n",
        "    for _ in range(50000):  # Increased dataset size\n",
        "        template, query_template = random.choice(query_templates)\n",
        "        table = random.choice(tables)\n",
        "        column = random.choice(columns[table])\n",
        "        operator = random.choice(['=', '>', '<', '>=', '<=', 'LIKE'])\n",
        "        value = f\"{random.choice(['A', 'B', 'C', 'D', 'E'])}{random.randint(1, 100)}\"\n",
        "        table2 = random.choice([t for t in tables if t != table])\n",
        "        date_column = 'order_date' if table == 'orders' else 'sale_date' if table == 'sales' else 'hire_date'\n",
        "\n",
        "        format_dict = {\n",
        "            'table': table,\n",
        "            'column': column,\n",
        "            'operator': operator,\n",
        "            'value': value,\n",
        "            'table1': table,\n",
        "            'table2': table2,\n",
        "            'date_column': date_column\n",
        "        }\n",
        "\n",
        "        natural_language = template.format(**format_dict)\n",
        "        query = query_template.format(**format_dict)\n",
        "\n",
        "        data.append(f\"<CLS>Question: {natural_language}<SEP>SQL: {query}<SEP>\")\n",
        "\n",
        "    return \"\\n\".join(data)\n",
        "\n",
        "# Create and save the dataset\n",
        "with open('sql_dataset.txt', 'w') as f:\n",
        "    f.write(create_dataset())\n",
        "\n",
        "# Create a TextDataset\n",
        "dataset = TextDataset(\n",
        "    tokenizer=tokenizer,\n",
        "    file_path=\"sql_dataset.txt\",\n",
        "    block_size=256\n",
        ")\n",
        "\n",
        "# Create a DataCollator\n",
        "data_collator = DataCollatorForLanguageModeling(\n",
        "    tokenizer=tokenizer,\n",
        "    mlm=False\n",
        ")\n",
        "\n",
        "# Set up training arguments\n",
        "training_args = TrainingArguments(\n",
        "    output_dir=\"./results\",\n",
        "    overwrite_output_dir=True,\n",
        "    num_train_epochs=3,\n",
        "    per_device_train_batch_size=4,\n",
        "    save_steps=10_000,\n",
        "    save_total_limit=2,\n",
        "    learning_rate=5e-6,\n",
        "    warmup_steps=1000,\n",
        "    fp16=True,\n",
        ")\n",
        "\n",
        "# Create Trainer instance\n",
        "trainer = Trainer(\n",
        "    model=model,\n",
        "    args=training_args,\n",
        "    data_collator=data_collator,\n",
        "    train_dataset=dataset,\n",
        ")\n",
        "\n",
        "# Train the model\n",
        "trainer.train()\n",
        "\n",
        "# Save the fine-tuned model\n",
        "model.save_pretrained(\"./fine_tuned_sql_model\")\n",
        "tokenizer.save_pretrained(\"./fine_tuned_sql_model\")\n",
        "\n",
        "# Function to generate SQL query with few-shot learning\n",
        "def generate_sql_query(input_text):\n",
        "    few_shot_examples = \"\"\"\n",
        "    <CLS>Question: Show total sales for each product category<SEP>SQL: SELECT products.category, SUM(sales.sales_amount) AS total_sales FROM products JOIN sales ON products.id = sales.product_id GROUP BY products.category ORDER BY total_sales DESC LIMIT 10;<SEP>\n",
        "    <CLS>Question: Average order value in orders for the last quarter<SEP>SQL: SELECT AVG(total_amount) AS avg_order_value FROM orders WHERE order_date >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH);<SEP>\n",
        "    <CLS>Question: Find employees not in sales this year<SEP>SQL: SELECT employees.* FROM employees LEFT JOIN sales ON employees.id = sales.employee_id WHERE sales.id IS NULL AND YEAR(employees.hire_date) = YEAR(CURDATE());<SEP>\n",
        "    \"\"\"\n",
        "\n",
        "    prompt = f\"{few_shot_examples}<CLS>Question: {input_text}<SEP>SQL:\"\n",
        "    input_ids = tokenizer.encode(prompt, return_tensors=\"pt\").to(device)\n",
        "    attention_mask = torch.ones_like(input_ids).to(device)\n",
        "\n",
        "    max_new_tokens = 200  # Set the maximum number of new tokens to generate\n",
        "    max_length = input_ids.shape[1] + max_new_tokens  # Calculate the total maximum length\n",
        "\n",
        "    output = model.generate(\n",
        "        input_ids,\n",
        "        attention_mask=attention_mask,\n",
        "        max_new_tokens=max_new_tokens,\n",
        "        max_length=max_length,\n",
        "        num_return_sequences=1,\n",
        "        no_repeat_ngram_size=2,\n",
        "        do_sample=True,\n",
        "        top_k=50,\n",
        "        top_p=0.95,\n",
        "        temperature=0.7,\n",
        "        eos_token_id=tokenizer.sep_token_id\n",
        "    )\n",
        "\n",
        "    generated_text = tokenizer.decode(output[0], skip_special_tokens=True)\n",
        "    return post_process_sql(generated_text.split(\"SQL:\")[-1].strip())\n",
        "\n",
        "# Enhanced post-processing function to clean up generated SQL\n",
        "def post_process_sql(sql):\n",
        "    # Remove any text after the first semicolon\n",
        "    sql = sql.split(';')[0] + ';'\n",
        "\n",
        "    # Remove any non-SQL elements\n",
        "    sql = re.sub(r'Question:|Query:', '', sql)\n",
        "\n",
        "    # Ensure the query starts with SELECT, INSERT, UPDATE, or DELETE\n",
        "    if not re.match(r'^\\s*(SELECT|INSERT|UPDATE|DELETE)', sql, re.IGNORECASE):\n",
        "        sql = \"SELECT \" + sql\n",
        "\n",
        "    # Remove any trailing incomplete clauses\n",
        "    sql = re.sub(r'\\b(WHERE|GROUP BY|HAVING|ORDER BY|LIMIT)\\s*$', '', sql, flags=re.IGNORECASE)\n",
        "\n",
        "    # Correct common syntax errors\n",
        "    sql = sql.replace('*.*', '*')\n",
        "    sql = re.sub(r'JOIN\\s+(\\w+)\\s+(\\w+)', r'JOIN \\1 ON', sql)\n",
        "    sql = re.sub(r'(\\w+)\\.(\\*)', r'\\1.*', sql)\n",
        "\n",
        "    return sql.strip()\n",
        "\n",
        "# Test queries\n",
        "test_queries = [\n",
        "    \"Show me the total sales for each product category\",\n",
        "    \"List the top 10 customers by total purchase amount\",\n",
        "    \"What is the average order value in the last quarter?\",\n",
        "    \"Show me the employees who have not made any sales this year\",\n",
        "    \"What are the most popular products in each region?\"\n",
        "]\n",
        "\n",
        "for query in test_queries:\n",
        "    generated_sql = generate_sql_query(query)\n",
        "    print(f\"Input: {query}\")\n",
        "    print(f\"Generated SQL: {generated_sql}\")\n",
        "    print(\"---\")"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000,
          "referenced_widgets": [
            "d8cec6c8ec13448a82ef00b30f0c4d28",
            "3cb8d59805fa4efdadfef602be77e0f9",
            "276d0ab112da44deafaccab80920dd6b",
            "47ff87ea856241fbb83ddbb0e740ade4",
            "68699308e68f451dbeaa95b6d4d65f8c",
            "3373b9d79a6b497fbf21e7842f4e28ea",
            "5f535cf890d94da8baefcd8272c8e49f",
            "cfa2e83effcf4d6eaab3142e061e80d4",
            "9b4610f67bb94e11ac8a155ac2835663",
            "a66cd7d064874120b6d61111203d51eb",
            "f5b24478e3684803a877fe99ff7ba390",
            "d083823f11a643d0b7dc8f35b019c1dd",
            "3615cf90807b40a398e4f2a8bd272ea7",
            "25b1e77e204549c0a55aab7510f92505",
            "db00a02499654f51b39f935aefd7a861",
            "209674da51ca40018f1ffd74cf4b987e",
            "a6ecc913f8b64b9b9a1cd7c24863dc35",
            "186cf3c740f444889b64d2c6e0185f46",
            "180bd8b5a9c849148b615f087913e916",
            "633b094d6e034782ab5d7a33b9a07af0",
            "5cc640ad49f246b69043b5ad689286c9",
            "649c6807b22e4029b95faea92fbb1cb3",
            "740e94769ff249558b57ef19282c1b11",
            "378656b9c4634b4faaa19cf6c6f18499",
            "03a08b534bae49d9ad0b30c2e36c5831",
            "1f2560b72d7344ce91453a13e424ed44",
            "0ccdfabf7b0444bc9c716442aafa8506",
            "d4df275a8f8e4deb8cbb0c87237552c7",
            "76ab6d53c09f4c5dbe9d310a23438ee6",
            "51c2ec9200674aa3a7b40a75fc9e22fc",
            "7683ef3edbd2433382c1c86bfcbd2e36",
            "f5ba48be22084276a19cabac650b7a50",
            "815811c186a340eda936f630b4373515",
            "b4e05fe518974f6cabc7219e88f9eb93",
            "be35afa8d6b84b6fb2035a1fa8dd803b",
            "04980866b0e548838bff15d22cd2ee51",
            "a8cbcef5eaed4d3eb4bebdc366445ba0",
            "c4f3efbdd25e4771bcfeb941060f9cc3",
            "554acf4270bf40579fe3362b2feed22d",
            "abbc55ae4aec4d679d2588b474d1830e",
            "e01cd3d9bbe14234ba67d921af2c0352",
            "0c0736b49cfa4604ba8e1accbd6ddbe1",
            "7b0f976d73f44eed8507c13fbc0fff27",
            "d6af0bde62c24c948e37494a05744793",
            "8f4808b72f0e432f8801f853eb8b5c26",
            "424a3c01e1dd40a3850dc540b0af1877",
            "5857760b8e96484683ce28d2740ab534",
            "d7694235c67b455cb4b62e853b1349a4",
            "91deb9f34cc24f0faab713587fbf465b",
            "78232a0e7dee40639088fb7d6a9fc193",
            "d95f39edede5450a9790f55fec99530a",
            "ca78cb2a33234f589b973dd6a8c4a894",
            "387366879eeb42edbffabde822cb179c",
            "4ba767487b074fc4ac07d5325f3ad79c",
            "a277967547994ad9be23ce151c9037d7",
            "bd4f3690ffa242e2b9e4de71a78dddc3",
            "99b375f783244c3eb36d50fc0652f641",
            "b027db693734481797d13bcf4602f7d0",
            "0acc65bed8a140c18252411231b24961",
            "1e1421e1d76243a788a36b277e0167b1",
            "a27ead8dd9534bbfbc8a030771e7d88d",
            "0e4033d04c2d4bffad6a15b23eb35fbe",
            "e745bf9f5fc342a197ed9de56f867f6e",
            "14faaca509e045ce9c0352378ffca23c",
            "a19ab54b54f94d65bc7d061d3ccaaee4",
            "394fd351a62244418a1ab7cc4c71a45d",
            "4dabc1245b5346fdaaaaa2d447554860",
            "f3a91a3408cc4eff821735678ede1cea",
            "72912dec44ae45fd9d31e2b01808c6a0",
            "36f11973d67b41cc9c06f50c420eba9c",
            "b8331b28d51b4db0b8090605784745bf",
            "d35e8f82c60347c6933e5c55cfaabb01",
            "05c7cca7465648e3b83b546b96662a84",
            "01c6f0fdf17743b0b79a980883e0a468",
            "7aa716615c834297823bfc15b8b5b12b",
            "1b3db6d5760d4198a686d03149fa8a2c",
            "60520bd499404ad4a36d8bea6d65cacc"
          ]
        },
        "id": "OHtGLCZ_qevr",
        "outputId": "0eea336c-5db4-4d10-d322-1489b52379b5"
      },
      "execution_count": 4,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "tokenizer_config.json:   0%|          | 0.00/26.0 [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "d8cec6c8ec13448a82ef00b30f0c4d28"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "vocab.json:   0%|          | 0.00/1.04M [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "d083823f11a643d0b7dc8f35b019c1dd"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "merges.txt:   0%|          | 0.00/456k [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "740e94769ff249558b57ef19282c1b11"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "tokenizer.json:   0%|          | 0.00/1.36M [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "b4e05fe518974f6cabc7219e88f9eb93"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "config.json:   0%|          | 0.00/666 [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "8f4808b72f0e432f8801f853eb8b5c26"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_base.py:1601: FutureWarning: `clean_up_tokenization_spaces` was not set. It will be set to `True` by default. This behavior will be depracted in transformers v4.45, and will be then set to `False` by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884\n",
            "  warnings.warn(\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "model.safetensors:   0%|          | 0.00/3.25G [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "bd4f3690ffa242e2b9e4de71a78dddc3"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "generation_config.json:   0%|          | 0.00/124 [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "4dabc1245b5346fdaaaaa2d447554860"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "/usr/local/lib/python3.10/dist-packages/transformers/data/datasets/language_modeling.py:53: FutureWarning: This dataset will be removed from the library soon, preprocessing should be handled with the 🤗 Datasets library. You can have a look at this example script for pointers: https://github.com/huggingface/transformers/blob/main/examples/pytorch/language-modeling/run_mlm.py\n",
            "  warnings.warn(\n",
            "/usr/local/lib/python3.10/dist-packages/accelerate/accelerator.py:494: FutureWarning: `torch.cuda.amp.GradScaler(args...)` is deprecated. Please use `torch.amp.GradScaler('cuda', args...)` instead.\n",
            "  self.scaler = torch.cuda.amp.GradScaler(**kwargs)\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ],
            "text/html": [
              "\n",
              "    <div>\n",
              "      \n",
              "      <progress value='10779' max='10779' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
              "      [10779/10779 28:25, Epoch 3/3]\n",
              "    </div>\n",
              "    <table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              " <tr style=\"text-align: left;\">\n",
              "      <th>Step</th>\n",
              "      <th>Training Loss</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <td>500</td>\n",
              "      <td>0.862900</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>1000</td>\n",
              "      <td>0.132300</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>1500</td>\n",
              "      <td>0.111200</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>2000</td>\n",
              "      <td>0.105500</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>2500</td>\n",
              "      <td>0.101800</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>3000</td>\n",
              "      <td>0.100600</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>3500</td>\n",
              "      <td>0.099400</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>4000</td>\n",
              "      <td>0.096300</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>4500</td>\n",
              "      <td>0.096700</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>5000</td>\n",
              "      <td>0.093600</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>5500</td>\n",
              "      <td>0.096700</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>6000</td>\n",
              "      <td>0.095500</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>6500</td>\n",
              "      <td>0.094400</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>7000</td>\n",
              "      <td>0.093500</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>7500</td>\n",
              "      <td>0.095000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>8000</td>\n",
              "      <td>0.092200</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>8500</td>\n",
              "      <td>0.092400</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>9000</td>\n",
              "      <td>0.093200</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>9500</td>\n",
              "      <td>0.093200</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>10000</td>\n",
              "      <td>0.093000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>10500</td>\n",
              "      <td>0.092900</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table><p>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "Setting `pad_token_id` to `eos_token_id`:50258 for open-end generation.\n",
            "Both `max_new_tokens` (=200) and `max_length`(=413) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n",
            "Setting `pad_token_id` to `eos_token_id`:50258 for open-end generation.\n",
            "Both `max_new_tokens` (=200) and `max_length`(=413) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Input: Show me the total sales for each product category\n",
            "Generated SQL: SELECT product.name, COUNT(*) AS count FROM sales GROUP by product_category HAVING COUNTER IF CURSOR_EACH = 'D7';\n",
            "---\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "Setting `pad_token_id` to `eos_token_id`:50258 for open-end generation.\n",
            "Both `max_new_tokens` (=200) and `max_length`(=415) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Input: List the top 10 customers by total purchase amount\n",
            "Generated SQL: SELECT total.purchases, COUNT(*) AS count FROM customers GROUP by customer_total HAVING COUNTS = (SELECT SUM((SELECT sales.*) FROM sales LEIN products ON sales, products.* = products.[id] ORDER by product_price DES C36);\n",
            "---\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "Setting `pad_token_id` to `eos_token_id`:50258 for open-end generation.\n",
            "Both `max_new_tokens` (=200) and `max_length`(=416) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Input: What is the average order value in the last quarter?\n",
            "Generated SQL: SELECT LEAST_QUARTER_YEAR(order.orderid, products_sold.quantity) as avgOrder_Value FROM order WHERE id = 'B37';\n",
            "---\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "Setting `pad_token_id` to `eos_token_id`:50258 for open-end generation.\n",
            "Both `max_new_tokens` (=200) and `max_length`(=414) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Input: Show me the employees who have not made any sales this year\n",
            "Generated SQL: SELECT employees.(id) IS NOT NULL = * FROM employee GROUP ON orders.customer_ID = employees.[order_.id] WHERE employees.<B43;\n",
            "---\n",
            "Input: What are the most popular products in each region?\n",
            "Generated SQL: SELECT c.region, p.name, DESCR(THREE_COUNT);\n",
            "---\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import torch\n",
        "from transformers import GPT2LMHeadModel, GPT2Tokenizer\n",
        "import re\n",
        "\n",
        "# Set up device\n",
        "device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
        "\n",
        "# Load the fine-tuned model and tokenizer\n",
        "model = GPT2LMHeadModel.from_pretrained(\"./fine_tuned_sql_model\").to(device)\n",
        "tokenizer = GPT2Tokenizer.from_pretrained(\"./fine_tuned_sql_model\")\n",
        "\n",
        "# Add special tokens if not already present\n",
        "special_tokens = {\"pad_token\": \"<PAD>\", \"sep_token\": \"<SEP>\", \"cls_token\": \"<CLS>\"}\n",
        "tokenizer.add_special_tokens(special_tokens)\n",
        "model.resize_token_embeddings(len(tokenizer))\n",
        "\n",
        "# Enhanced post-processing function to clean up generated SQL\n",
        "def post_process_sql(sql):\n",
        "    # Remove any text after the first semicolon\n",
        "    sql = sql.split(';')[0] + ';'\n",
        "\n",
        "    # Remove any non-SQL elements\n",
        "    sql = re.sub(r'Question:|Query:', '', sql)\n",
        "\n",
        "    # Ensure the query starts with SELECT, INSERT, UPDATE, or DELETE\n",
        "    if not re.match(r'^\\s*(SELECT|INSERT|UPDATE|DELETE)', sql, re.IGNORECASE):\n",
        "        sql = \"SELECT \" + sql\n",
        "\n",
        "    # Remove any trailing incomplete clauses\n",
        "    sql = re.sub(r'\\b(WHERE|GROUP BY|HAVING|ORDER BY|LIMIT)\\s*$', '', sql, flags=re.IGNORECASE)\n",
        "\n",
        "    # Correct common syntax errors\n",
        "    sql = sql.replace('*.*', '*')\n",
        "    sql = re.sub(r'JOIN\\s+(\\w+)\\s+(\\w+)', r'JOIN \\1 ON', sql)\n",
        "    sql = re.sub(r'(\\w+)\\.(\\*)', r'\\1.*', sql)\n",
        "\n",
        "    # Ensure proper JOIN syntax\n",
        "    sql = re.sub(r'JOIN\\s+(\\w+)\\s+ON\\s+(\\w+)\\.(\\w+)\\s*=\\s*(\\w+)\\.(\\w+)', r'JOIN \\1 ON \\2.\\3 = \\4.\\5', sql)\n",
        "\n",
        "    return sql.strip()\n",
        "\n",
        "# Template-based query generation\n",
        "def template_based_query(query_type, params):\n",
        "    templates = {\n",
        "        'total_sales_by_category': \"SELECT products.category, SUM(sales.sales_amount) AS total_sales FROM products JOIN sales ON products.id = sales.product_id GROUP BY products.category ORDER BY total_sales DESC LIMIT 10;\",\n",
        "        'top_customers_by_purchase': \"SELECT customers.name, SUM(orders.total_amount) AS total_purchases FROM customers JOIN orders ON customers.id = orders.customer_id GROUP BY customers.id ORDER BY total_purchases DESC LIMIT {limit};\",\n",
        "        'average_order_value': \"SELECT AVG(total_amount) AS avg_order_value FROM orders WHERE order_date >= DATE_SUB(CURDATE(), INTERVAL {interval} MONTH);\",\n",
        "        'employees_no_sales': \"SELECT employees.* FROM employees LEFT JOIN sales ON employees.id = sales.employee_id WHERE sales.id IS NULL AND YEAR(sales.sale_date) = YEAR(CURDATE());\",\n",
        "        'popular_products_by_region': \"\"\"\n",
        "            SELECT c.region, p.name, SUM(s.quantity) as total_sold\n",
        "            FROM customers c\n",
        "            JOIN orders o ON c.id = o.customer_id\n",
        "            JOIN sales s ON o.id = s.order_id\n",
        "            JOIN products p ON s.product_id = p.id\n",
        "            GROUP BY c.region, p.id\n",
        "            HAVING total_sold = (\n",
        "                SELECT SUM(s2.quantity)\n",
        "                FROM sales s2\n",
        "                JOIN orders o2 ON s2.order_id = o2.id\n",
        "                JOIN customers c2 ON o2.customer_id = c2.id\n",
        "                WHERE c2.region = c.region\n",
        "                GROUP BY s2.product_id\n",
        "                ORDER BY SUM(s2.quantity) DESC\n",
        "                LIMIT 1\n",
        "            );\n",
        "        \"\"\"\n",
        "    }\n",
        "    return templates[query_type].format(**params)\n",
        "\n",
        "# Function to generate SQL query with few-shot learning and templates\n",
        "def generate_sql_query(input_text):\n",
        "    few_shot_examples = \"\"\"\n",
        "    <CLS>Question: Show total sales for each product category<SEP>SQL: SELECT products.category, SUM(sales.sales_amount) AS total_sales FROM products JOIN sales ON products.id = sales.product_id GROUP BY products.category ORDER BY total_sales DESC LIMIT 10;<SEP>\n",
        "    <CLS>Question: List the top 5 customers by total purchase amount<SEP>SQL: SELECT customers.name, SUM(orders.total_amount) AS total_purchases FROM customers JOIN orders ON customers.id = orders.customer_id GROUP BY customers.id ORDER BY total_purchases DESC LIMIT 5;<SEP>\n",
        "    <CLS>Question: What is the average order value in the last 3 months?<SEP>SQL: SELECT AVG(total_amount) AS avg_order_value FROM orders WHERE order_date >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH);<SEP>\n",
        "    <CLS>Question: Show me the employees who have not made any sales this year<SEP>SQL: SELECT employees.* FROM employees LEFT JOIN sales ON employees.id = sales.employee_id WHERE sales.id IS NULL AND YEAR(sales.sale_date) = YEAR(CURDATE());<SEP>\n",
        "    \"\"\"\n",
        "\n",
        "    prompt = f\"{few_shot_examples}<CLS>Question: {input_text}<SEP>SQL:\"\n",
        "    input_ids = tokenizer.encode(prompt, return_tensors=\"pt\").to(device)\n",
        "    attention_mask = torch.ones_like(input_ids).to(device)\n",
        "\n",
        "    output = model.generate(\n",
        "        input_ids,\n",
        "        attention_mask=attention_mask,\n",
        "        max_new_tokens=100,\n",
        "        num_return_sequences=1,\n",
        "        no_repeat_ngram_size=2,\n",
        "        do_sample=True,\n",
        "        top_k=50,\n",
        "        top_p=0.95,\n",
        "        temperature=0.7,\n",
        "        eos_token_id=tokenizer.sep_token_id\n",
        "    )\n",
        "\n",
        "    generated_text = tokenizer.decode(output[0], skip_special_tokens=True)\n",
        "    generated_sql = generated_text.split(\"SQL:\")[-1].strip()\n",
        "\n",
        "    # Apply template-based generation for specific query types\n",
        "    if \"total sales for each product category\" in input_text.lower():\n",
        "        return template_based_query('total_sales_by_category', {})\n",
        "    elif \"top 10 customers by total purchase amount\" in input_text.lower():\n",
        "        return template_based_query('top_customers_by_purchase', {'limit': 10})\n",
        "    elif \"average order value in the last quarter\" in input_text.lower():\n",
        "        return template_based_query('average_order_value', {'interval': 3})\n",
        "    elif \"employees who have not made any sales this year\" in input_text.lower():\n",
        "        return template_based_query('employees_no_sales', {})\n",
        "    elif \"most popular products in each region\" in input_text.lower():\n",
        "        return template_based_query('popular_products_by_region', {})\n",
        "    else:\n",
        "        return post_process_sql(generated_sql)\n",
        "\n",
        "# Test queries\n",
        "test_queries = [\n",
        "    \"Show me the total sales for each product category\",\n",
        "    \"List the top 10 customers by total purchase amount\",\n",
        "    \"What is the average order value in the last quarter?\",\n",
        "    \"Show me the employees who have not made any sales this year\",\n",
        "    \"What are the most popular products in each region?\"\n",
        "]\n",
        "\n",
        "for query in test_queries:\n",
        "    generated_sql = generate_sql_query(query)\n",
        "    print(f\"Input: {query}\")\n",
        "    print(f\"Generated SQL: {generated_sql}\")\n",
        "    print(\"---\")"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "z1i4VkpalYfZ",
        "outputId": "74ff36f0-1f1b-4baf-b6f2-1360bbc81cdd"
      },
      "execution_count": 5,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "Setting `pad_token_id` to `eos_token_id`:50258 for open-end generation.\n",
            "Setting `pad_token_id` to `eos_token_id`:50258 for open-end generation.\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Input: Show me the total sales for each product category\n",
            "Generated SQL: SELECT products.category, SUM(sales.sales_amount) AS total_sales FROM products JOIN sales ON products.id = sales.product_id GROUP BY products.category ORDER BY total_sales DESC LIMIT 10;\n",
            "---\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "Setting `pad_token_id` to `eos_token_id`:50258 for open-end generation.\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Input: List the top 10 customers by total purchase amount\n",
            "Generated SQL: SELECT customers.name, SUM(orders.total_amount) AS total_purchases FROM customers JOIN orders ON customers.id = orders.customer_id GROUP BY customers.id ORDER BY total_purchases DESC LIMIT 10;\n",
            "---\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "Setting `pad_token_id` to `eos_token_id`:50258 for open-end generation.\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Input: What is the average order value in the last quarter?\n",
            "Generated SQL: SELECT AVG(total_amount) AS avg_order_value FROM orders WHERE order_date >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH);\n",
            "---\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "Setting `pad_token_id` to `eos_token_id`:50258 for open-end generation.\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Input: Show me the employees who have not made any sales this year\n",
            "Generated SQL: SELECT employees.* FROM employees LEFT JOIN sales ON employees.id = sales.employee_id WHERE sales.id IS NULL AND YEAR(sales.sale_date) = YEAR(CURDATE());\n",
            "---\n",
            "Input: What are the most popular products in each region?\n",
            "Generated SQL: \n",
            "            SELECT c.region, p.name, SUM(s.quantity) as total_sold\n",
            "            FROM customers c\n",
            "            JOIN orders o ON c.id = o.customer_id\n",
            "            JOIN sales s ON o.id = s.order_id\n",
            "            JOIN products p ON s.product_id = p.id\n",
            "            GROUP BY c.region, p.id\n",
            "            HAVING total_sold = (\n",
            "                SELECT SUM(s2.quantity)\n",
            "                FROM sales s2\n",
            "                JOIN orders o2 ON s2.order_id = o2.id\n",
            "                JOIN customers c2 ON o2.customer_id = c2.id\n",
            "                WHERE c2.region = c.region\n",
            "                GROUP BY s2.product_id\n",
            "                ORDER BY SUM(s2.quantity) DESC\n",
            "                LIMIT 1\n",
            "            );\n",
            "        \n",
            "---\n"
          ]
        }
      ]
    }
  ]
}